import request from '@/utils/request'

// 查询结算单列表
export function listSettlebill(query) {
  return request({
    url: '/doc/settlebill/list',
    method: 'get',
    params: query
  })
}

// 查询结算单详细
export function getSettlebill(id) {
  return request({
    url: '/doc/settlebill/' + id,
    method: 'get'
  })
}


// 根据SettleId查询结算单详细
export function getSettlebillBySettleId(settleId) {
  return request({
    url: '/doc/settlebill/getBySettleId/' + settleId,
    method: 'get'
  })
}


// 根据Id查询结算单详细-开票用
export function getByIdForInvoice(id) {
  return request({
    url: '/doc/settlebill/getByIdForInvoice/' + id,
    method: 'get'
  })
}

// 根据Id集合查询结算单详细-合并开票用
export function getByIdsForMergeInvoice(id) {
  return request({
    url: '/doc/settlebill/getByIdsForMergeInvoice/' + id,
    method: 'get'
  })
}

// 新增结算单
export function addSettlebill(data) {
  return request({
    url: '/doc/settlebill',
    method: 'post',
    data: data
  })
}

// 修改结算单
export function updateSettlebill(data) {
  return request({
    url: '/doc/settlebill',
    method: 'put',
    data: data
  })
}


// 删除结算单
export function delSettlebill(id) {
  return request({
    url: '/doc/settlebill/' + id,
    method: 'delete'
  })
}


// 结算单生成待开
export function doCreateInvoice(id) {
  return request({
    url: '/doc/settlebill/doCreateInvoice/' + id,
    method: 'put'
  })
}


// 保存拆分
export function saveAsSalInvoice(data) {
  return request({
    url: '/doc/settlebill/saveAsSalInvoice',
    method: 'put',
    data: data
  })
}


// 保存拆分
export function saveAsMergeSalInvoice(data) {
  return request({
    url: '/doc/settlebill/saveAsMergeSalInvoice',
    method: 'put',
    data: data
  })
}
